import Vue from "vue";
// 引入vuex
import Vuex from "vuex";
// 在vue中使用vuex
Vue.use(Vuex);
// 初始化仓库并暴露
export default new Vuex.Store({
  state: {
    count: 0,
    num: 0,
  },
  mutations: {
    // mutations方法接受state作为第一个参数
    increament(state) {
      state.count++;
    },
    increamentN(state, payload) {
      state.count += payload.n;
    },
  },
  actions: {},
  getters: {},
});
